﻿function GetActiveTree() {
    var _0x1621x2 = GetUrlFolderPath()['toLowerCase']();
    var _0x1621x3 = GetUrlRelativePath()['toLowerCase']();
    if (_0x1621x2 == '' || _0x1621x3 == '') {
        window['location']['href'] = '/home/index'
    } else {
        $('.sidebar-menu .active')['each'](function () {
            $(this)['removeClass']('active')['removeClass']('menu-open')
        });
        $('.sidebar-menu a')['each'](function () {
            var _0x1621x4 = $(this)['attr']('href')['toLowerCase']();
            var _0x1621x5 = _0x1621x4['indexOf']('/');
            var _0x1621x6 = _0x1621x4['substring'](_0x1621x5 + 1);
            var _0x1621x7 = _0x1621x6['indexOf']('/');
            _0x1621x4 = _0x1621x6['substring'](0, _0x1621x7);
            if (_0x1621x4 == _0x1621x2) {
                $(this)['parents']('.treeview')['addClass']('active')['addClass']('menu-open');
                $(this)['parents']('.mytree')['addClass']('active')['addClass']('menu-open');
                if (_0x1621x6 == _0x1621x3) {
                    $(this)['attr']('style', 'color:#333;background-color:#ffffff')
                }
            }
        })
    }
}
function GetUrlRelativePath() {
    var _0x1621x9 = document['location'].toString();
    var _0x1621xa = _0x1621x9['split']('//');
    var _0x1621x5 = _0x1621xa[1]['indexOf']('/');
    var _0x1621x3 = _0x1621xa[1]['substring'](_0x1621x5 + 1);
    return _0x1621x3
}
function GetUrlFolderPath() {
    var _0x1621x9 = document['location'].toString();
    var _0x1621xa = _0x1621x9['split']('//');
    var _0x1621x5 = _0x1621xa[1]['indexOf']('/');
    var _0x1621x3 = _0x1621xa[1]['substring'](_0x1621x5 + 1);
    var _0x1621x7 = _0x1621x3['indexOf']('/');
    _0x1621x3 = _0x1621x3['substring'](0, _0x1621x7);
    return _0x1621x3
}
function GetUserName() {
    $['ajax']({
        type: 'get',
        url: '/home/GetUserName',
        dataType: 'json',
        data: {},
        success: function (_0x1621xd) {
            $('#i_u_name')['text'](_0x1621xd);
            $('#u_name')['text'](_0x1621xd)
        }
    })
}
function GetRole() {
    $['ajax']({
        type: 'get',
        url: '/home/GetRole',
        dataType: 'json',
        data: {},
        success: function (_0x1621xd) {
            switch (_0x1621xd) {
            case 48:
                $('#order_li')['show']();
                $('#finance_li')['remove']();
                break;
            case 49:
                $('#order_li')['show']();
                $('#finance_li')['remove']();
                break;
            case 1:
                $('#order_li')['show']();
                $('#finance_li')['show']();
                break;
            case 47:
                $('#order_li')['show']();
                $('#finance_li')['show']();
                break;
            case 58:
                $('#order_li')['show']();
                $('#finance_li')['show']();
                break;
            default:
                break
            }
        }
    })
}